home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / viewwrld / viewwrld.lha / viewworld / gr / gr_header.ps < prev    next >
Encoding:
Text File  |  1989-09-21  |  4.4 KB  |  161 lines

  1. % $Id: gr_header.ps,v 2.3 89/09/20 17:01:32 mbp Exp $
  2. %
  3. % gr_header.ps: PostScript header file
  4. %
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. %        Copyright (C) 1989 by Mark B. Phillips                 %
  7. %                                        %
  8. % Permission to use, copy, modify, and distribute this software and    %
  9. % its documentation for any purpose and without fee is hereby granted, %
  10. % provided that the above copyright notice appear in all copies and    %
  11. % that both that copyright notice and this permission notice appear in %
  12. % supporting documentation, and that the name of Mark B. Phillips or   %
  13. % the University of Maryland not be used in advertising or publicity   %
  14. % pertaining to distribution of the software without specific, written %
  15. % prior permission.  This software is provided "as is" without express %
  16. % or implied warranty.                                                 %
  17. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  18. %
  19. %   This file must be preceeded by PostScript lines of the following
  20. %   form, where lines enclosed in [ ] are optional (the [ ] are NOT
  21. %   part of the lines):
  22. %
  23. %    %!
  24. %    /CanvasWidth WIDTH def
  25. %    /CanvasHeight HEIGHT def
  26. %    /LabelPresent LABELFLAG def
  27. %     [    /Label (LABEL) def ]
  28. %    /TimePresent TIMEFLAG def
  29. %     [ /Time (TIME) def ]
  30. %    /LogoPresent LOGOFLAG def
  31. %     [ /Logo (LOGO) def ]
  32. %
  33. %   where
  34. %    WIDTH = width (in pixels) of drawing area
  35. %    HEIGHT = hieght (in pixels) of drawing area
  36. %    LABELFLAG = 0 or 1; if 0, the /Label line
  37. %        may be omitted; if 1, the /Label line is required
  38. %    LABEL = string to use as picture label
  39. %    LOGOLFLAG = 0 or 1; if 0, the /Logo line
  40. %        may be omitted; if 1, the /Logo line is required
  41. %    LOGO = string to use as program logo
  42. %    TIMEFLAG =  0 or 1; if 0, the /Time line
  43. %        may be omitted; if 1, the /Time line is required
  44. %    TIME = string containing current date and time
  45. %
  46. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  47.  
  48. %
  49. % Set up picture coordinate system and drawing defs
  50. %
  51.  
  52. /CanvasAspectRatio CanvasWidth CanvasHeight div def
  53. /inch {72 mul} def
  54. /PaperWidth 8.5 inch def
  55. /PaperHeight 11.0 inch def
  56. /LeftMargin 1.0 inch def
  57. /RightMargin 1.0 inch def
  58. /PictureWidth PaperWidth LeftMargin RightMargin add sub def
  59. /PictureHeight CanvasAspectRatio PictureWidth mul def
  60. /Xoffset LeftMargin def
  61. /Yoffset PaperHeight PictureHeight sub 2 div def
  62. /xScaleFactor PictureWidth CanvasHeight div def
  63. /yScaleFactor PictureHeight CanvasWidth div def
  64. /LabelPointSize 16 def
  65. /TimePointSize 12 def
  66. /LogoPointSize 16 def
  67. %
  68. % Do the logo, if there is one
  69. %
  70.  
  71. 1 LogoPresent eq
  72. {
  73.     gsave
  74.     /Times-BoldItalic findfont
  75.     LogoPointSize scalefont setfont
  76. %    LogoPointSize 2 mul
  77. %    LogoPointSize 1.5 mul
  78.     .5 inch
  79.     .5 inch
  80.       translate
  81.     90 rotate
  82.     0 0 moveto
  83.     Logo show
  84.     grestore
  85. } if
  86.  
  87. %
  88. % Do the time stamp, if there is one
  89. %
  90.  
  91. 1 TimePresent eq
  92. {
  93.     gsave
  94.     /Times-Roman findfont
  95.     TimePointSize scalefont setfont
  96.     .5 inch
  97.     PaperHeight .5 inch sub
  98.     Time stringwidth pop sub
  99. %      y-coord of translation is
  100. %        PaperHeight - .5 inch - <width of Time string>
  101.       translate
  102.     90 rotate
  103.     0 0 moveto
  104.     Time show
  105.     grestore
  106. } if
  107.  
  108. /ThinlineWidth 1.0 yScaleFactor div 0.01 mul def
  109. /ThicklineWidth 1.0 yScaleFactor div def
  110. /PointRadius 1.0 yScaleFactor div def
  111. /m {exch newpath moveto} def
  112. /d {exch lineto currentpoint stroke moveto} def
  113. /a {gsave newpath
  114.     /ang2 exch def /ang1 exch def /r exch def
  115.     /xc exch def /yc exch def
  116.     xc yc translate
  117.     0 0 r ang1 ang2 arc stroke grestore} def
  118. /c {gsave newpath /r exch def /x exch def /y exch def
  119.     x y r 0 360 arc stroke grestore} def
  120. /di {gsave newpath /r exch def /y exch def /x exch def
  121.     x y r 0 360 arc fill grestore} def
  122. /p {currentpoint PointRadius di} def
  123. /DoBox {0            0           moveto
  124.     0            CanvasWidth lineto
  125.     CanvasHeight CanvasWidth lineto
  126.     CanvasHeight 0           lineto
  127.     0            0           lineto } def
  128. Xoffset Yoffset translate
  129. xScaleFactor yScaleFactor scale
  130.  
  131. %
  132. %  Do the picture label, if there is one
  133.  
  134. 1 LabelPresent eq
  135. {
  136.     gsave
  137.     /Times-Roman findfont
  138.     LabelPointSize scalefont setfont
  139.     Label stringwidth pop
  140.     /LabelWidth exch def
  141.     CanvasHeight LabelPointSize 1.5 mul add
  142.     CanvasWidth 2 div LabelWidth 2 div sub
  143.       translate
  144.     90 rotate
  145.     0 0 moveto
  146.     Label show
  147.     grestore
  148. } if
  149.  
  150. %
  151. %  Draw outline of box and clip subsequent graphics to this box
  152. %
  153. ThicklineWidth setlinewidth
  154. newpath DoBox stroke
  155. newpath DoBox clip
  156. ThinlineWidth setlinewidth
  157. %
  158. %  end of header
  159. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  160.